<?php

//require_once(HOME_DIR . "/libraries/simple_html_dom.php");
//$html = file_get_html($link_craw);
//$affID = "24244";
$db = new models($host,$user,$pass,$db_name);
$db->order("name DESC");
$kw = ($keyword != 'personal+name') ? $keyword : '';
if($kw){
	$db->where("name LIKE '%$kw%'");
	$db->limit("6");
	$products = $db->get_data("products");
}

?>

<div class="container-fluid" id="page-home">
	<div class="row">
		<div class="col-sm-12 col-md-12 col-lg-12">
		<?php
			if($products != null){
				foreach($products as $product){
					echo "<div class='col-xs-6 col-sm-4 col-md-3 col-lg-2'>";
						echo "<div class='thumbnail mark-best-seller'><span class='text-center'>Best seller</span>";
							echo "<a href='".$product['link']."' title='".$product['name']."'>";
								echo "<img class='thumbIcon' src='$home_url/images/photos/".$product['photo']."' alt='".$product['name']."' />";
							echo "</a>";
							echo "<div class='caption'>";
								echo "<h3 class='text-overflow'>".$product['name']."</h3>";
								echo "<p class='clearfix' style='margin-bottom:0'>";
									echo "<label class='text-overflow label label-success padding10 pull-left'>".$product['category']."</label>";
									echo "<label class='label label-primary padding10 pull-right'>".$product['price']."</label>";
								echo "</p>";
							echo "</div>";
						echo "</div>";
					echo "</div>";
				}
			}
		?>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12 col-md-12 col-lg-12">
			<fieldset style="padding:10px">
				<legend style="font-size:30px;padding-bottom:10px">MOST POPULAR PRODUCTS</legend>
			</fieldset>
		</div>
	</div>
	<div id="contentLoad" class="row">
	<?php
		/* if($html){
			foreach($html->find("#col2 .productIcon") as $product){
				
				$title=$product->find("table td.product-Title",0);
				$tagA = $product->find("div.frame center a",0);
				$tagA->href = $tagA->href . "?$affID";
				$tagA->target = "_blank";
				//$img = $product->find("div.frame center a img",0);
				$cat = $product->find("table td.product-cat",0);
				$price = $product->find("table td.product-price",0);
				
				echo "<div class='col-xs-6 col-sm-4 col-md-3 col-lg-2'>";
					echo "<div class='thumbnail'>";
						//echo "<img src='" . $img->src . "' alt='".$title->plaintext."' />";
						echo $tagA->parent();
						echo "<div class='caption'>";
							echo "<h3 class='text-overflow'>".$title->plaintext."</h3>";
							echo "<p class='clearfix' style='margin-bottom:0'>";
								echo "<label class='text-overflow label label-success padding10 pull-left'>".$cat->innertext."</label>";
								echo "<label class='label label-primary padding10 pull-right'>".$price->plaintext."</label>";
							echo "</p>";
						echo "</div>";
					echo "</div>";
				echo "</div>";
			}
		} */
	?>
	</div><!-- end .row -->
</div>